< previous page page_438 next page >

Page 438
9f31265bb40b592b1929e18a47ab28e5.gif
NOTE
You can also use the forms
EmpID property instead of the Tag property, but then you need to check to see whether the form was a form that is of the type frmEmployee. The benefit of the Tag property is that its already built into the form, so you dont need to do any additional checking.
Checking for Instances of Forms
If you need to check to see whether a particular instance of a form is loaded, you can use the Forms collection:
9f31265bb40b592b1929e18a47ab28e5.gif
Public Function IsFormLoaded(ByVal strName As String) _
       As Boolean
   Dim oForm As Form
   Dim boolReturn As Boolean

   For Each oForm In Forms
      If oForm.Name = strName Then
         boolReturn = True
      End If
   Next

   IsFormLoaded = boolReturn
End Function
The Controls Collection
The Controls collection is a part of every form at runtime. It refers to all the loaded controls on a form. You can use this collection to your advantage to perform field validation on controls.
Examples Filename: Employee.frm
In the Employee.frm form, the user is required to enter an employee ID and first and last names in the appropriate fields. If these values are not entered, you need to inform the user that they are required. There are many techniques for showing the user which fields need to be filled in. For example, you can change the background color of the text box or of the label next to the text box. Of course, if the

 
< previous page page_438 next page >

If you like this book, buy it!